<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var arr1 = [111, 2, 3, 4, 5, 66]
      var arr2 = [111, 222, 3, 4, 5, 66]
      var arr3 = [111, 2, 3333, 4, 5, 66]
      var arr4 = [111, 2, 3, 44444, 5, 66]

      function getArrMax(arr) {
        var arrMax = arr[0]
        for (var i = 1; i < arr.length; i++) {
          if (arr[i] > arrMax) {
            arrMax = arr[i]
          }
        }
        return arrMax
      }
      var res1 = getArrMax(arr1)
      var res2 = getArrMax([111, 2, 3333, 4, 5, 66])
      console.log(res1,res2)
    </script>
  </body>
</html>
